package com.maiji.cloud.controller.community;


import com.maiji.cloud.controller.BaseController;
import com.maiji.cloud.request.BaseInputDto;
import com.maiji.cloud.request.IdInputDto;
import com.maiji.cloud.request.community.ComUserRelationInputDto;
import com.maiji.cloud.response.BaseOutPutDto;
import com.maiji.cloud.response.login.UserInfoResData;
import com.maiji.cloud.response.login.UserInfoResDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2019-07-04
 */
@RestController
@RequestMapping("/community")
@Api(tags = {"社区"})
public class ComUserRelationController extends BaseController {

    @ApiOperation("用户关注人列表")
    @PostMapping("/focuserList")
    public BaseOutPutDto<List<UserInfoResData>>focuserList(@RequestBody BaseInputDto inputDto, @RequestHeader("maijiToken")String maijiToken){
        return postForObjectWithToken(maijiToken, REST_URL_PREFIX_COMMUNITY + "/community/focuserList", inputDto, BaseOutPutDto.class);
    }
    @PostMapping("/followerList")
    @ApiOperation("用户粉丝列表")
    public BaseOutPutDto<List<UserInfoResData>>followerList(@RequestBody BaseInputDto inputDto , @RequestHeader("maijiToken")String maijiToken){
        return postForObjectWithToken(maijiToken, REST_URL_PREFIX_COMMUNITY + "/community/followerList", inputDto, BaseOutPutDto.class);
    }

    @PostMapping("/focusUser")
    @ApiOperation("关注用户")
    public BaseOutPutDto<String> focusUser(@RequestBody BaseInputDto<IdInputDto> inputDto, @RequestHeader("maijiToken")String maijiToken){

        return postForObjectWithToken(maijiToken, REST_URL_PREFIX_COMMUNITY + "/community/focusUser", inputDto, BaseOutPutDto.class);
    }

    @PostMapping("/cancelFocusUser")
    @ApiOperation("取消关注用户")
    public BaseOutPutDto<String> cancelFocusUser(@RequestBody BaseInputDto<IdInputDto> inputDto, @RequestHeader("maijiToken")String maijiToken){

        return postForObjectWithToken(maijiToken, REST_URL_PREFIX_COMMUNITY + "/community/cancelFocusUser", inputDto, BaseOutPutDto.class);
    }


}

